/*
  Copyright (c) 2011, Mikheev Rostislav
  Copyright (c) 2011, FreshFarsh team

  Steel Engine source code is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
/**
  @author Mikheev Rostislav <hacenator@gmail.com>
  @date 13.03.2011
  @brief Window events listener interfaces header file.
*/

#ifndef STEEL_LISTENER_H_
#define STEEL_LISTENER_H_

#include "common.h"
#include "window_manager.h"

namespace _STEEL_NAMESPACE {

/// Basic Listener Class
class IListener {
 public:
  // for test
  virtual bool IsListener();

 protected:
  WindowManager *_window; ///< window to listen

  virtual void Listen(const WindowManager *window); ///< start listen
  virtual void StopListen() { }; ///< stop listen
};

/// Mouse events listener
class IMouseListener : public IListener {
 public:
  void Listen(const WindowManager *window);
  void StopListen();

  virtual void OnMouseMove(int x, int y) {};
  virtual void OnMouseUp(int x, int y, int button) {};
  virtual void OnMouseDown(int x, int y, int button) {};

 private:
  ListenerId _mouse_move_listener;
  ListenerId _mouse_up_listener;
  ListenerId _mouse_down_listener;
};

/// Keyboard events listener
class IKeyboardListener : public IListener {
 public:
  void Listen(const WindowManager *window);
  void StopListen();

  virtual void OnKeyUp(int key) {};
  virtual void OnKeyDown(int key) {};

 private:
  ListenerId _key_up_listener;
  ListenerId _key_down_listener;
};

/// Application state events listener
class IWindowListener : public IListener {
 public:
  void Listen(const WindowManager *window);
  void StopListen();

  virtual void OnInit() {};
  virtual void OnDraw() {};
  virtual void OnClose() {};

 private:
  ListenerId _open_listener;
  ListenerId _close_listener;
  ListenerId _draw_listener;
};

}

#endif // STEEL_LISTENER_H_
